<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LINE 1 &quot;libraries\\Win32\\System\\Win32\\Info\\Computer.hsc&quot; #-}</span><span>
</span><span id="line-1"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-comment">{- |
   Module      :  System.Win32.Info.Computer
   Copyright   :  2012-2013 shelarcy
   License     :  BSD-style

   Maintainer  :  shelarcy@gmail.com
   Stability   :  Provisional
   Portability :  Non-portable (Win32 API)

   Information about your computer.
-}</span><span>
</span><span id="line-13"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Win32.Info.Computer</span><span>
</span><span id="line-14"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="hs-comment">-- * Environment Strings</span><span>
</span><span id="line-15"></span><span>    </span><span class="hs-identifier">expandEnvironmentStrings</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">c_ExpandEnvironmentStrings</span><span>
</span><span id="line-16"></span><span>
</span><span id="line-17"></span><span>    </span><span class="hs-comment">-- * Computer Name</span><span>
</span><span id="line-18"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getComputerName</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">setComputerName</span><span>
</span><span id="line-19"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">c_GetComputerName</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">c_SetComputerName</span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span>    </span><span class="hs-comment">-- * System metrics</span><span>
</span><span id="line-22"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getSystemMetrics</span><span>
</span><span id="line-23"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sM_CMONITORS</span><span>
</span><span id="line-24"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sM_IMMENABLED</span><span>
</span><span id="line-25"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sM_MOUSEWHEELPRESENT</span><span>
</span><span id="line-26"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sM_REMOTESESSION</span><span>
</span><span id="line-27"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sM_SAMEDISPLAYFORMAT</span><span>
</span><span id="line-28"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sM_XVIRTUALSCREEN</span><span>
</span><span id="line-29"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sM_YVIRTUALSCREEN</span><span>
</span><span id="line-30"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sM_SERVERR2</span><span>
</span><span id="line-31"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sM_MEDIACENTER</span><span>
</span><span id="line-32"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sM_STARTER</span><span>
</span><span id="line-33"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sM_TABLETPC</span><span>
</span><span id="line-34"></span><span>
</span><span id="line-35"></span><span>  </span><span class="hs-comment">-- * User name</span><span>
</span><span id="line-36"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getUserName</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">c_GetUserName</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span>  </span><span class="hs-comment">-- * Version Info</span><span>
</span><span id="line-39"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">OSVERSIONINFOEX</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">POSVERSIONINFOEX</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LPOSVERSIONINFOEX</span><span>
</span><span id="line-40"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ProductType</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getVersionEx</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">c_GetVersionEx</span><span>
</span><span id="line-42"></span><span>
</span><span id="line-43"></span><span>  </span><span class="hs-comment">-- * Processor features</span><span>
</span><span id="line-44"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span>
</span><span id="line-45"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">isProcessorFeaturePresent</span><span>
</span><span id="line-46"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pF_3DNOW_INSTRUCTIONS_AVAILABLE</span><span>
</span><span id="line-47"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pF_COMPARE_EXCHANGE_DOUBLE</span><span>
</span><span id="line-48"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pF_FLOATING_POINT_EMULATED</span><span>
</span><span id="line-49"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pF_FLOATING_POINT_PRECISION_ERRATA</span><span>
</span><span id="line-50"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pF_MMX_INSTRUCTIONS_AVAILABLE</span><span>
</span><span id="line-51"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pF_PAE_ENABLED</span><span>
</span><span id="line-52"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pF_RDTSC_INSTRUCTION_AVAILABLE</span><span>
</span><span id="line-53"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pF_XMMI_INSTRUCTIONS_AVAILABLE</span><span>
</span><span id="line-54"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">pF_XMMI64_INSTRUCTIONS_AVAILABLE</span><span>
</span><span id="line-55"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.Marshal.Utils</span><span> </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">with</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.Storable</span><span>      </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">Storable</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Info</span><span>     </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">SMSetting</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Info.Version</span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.String</span><span>   </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">LPCTSTR</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LPTSTR</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">withTString</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">withTStringBuffer</span><span>
</span><span id="line-62"></span><span>                             </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">peekTString</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">peekTStringLen</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Types</span><span>    </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">BOOL</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Utils</span><span>    </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">tryWithoutNull</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Word</span><span>     </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">DWORD</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LPDWORD</span><span> </span><span class="hs-special">)</span><span class="hs-cpp">




#include &quot;windows_cconv.h&quot;
</span><span>
</span><span id="line-72"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- Environment Strings</span><span>
</span><span id="line-74"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-75"></span><span class="hs-identifier">expandEnvironmentStrings</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">String</span><span>
</span><span id="line-76"></span><span class="hs-identifier">expandEnvironmentStrings</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-77"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-78"></span><span>    </span><span class="hs-identifier">tryWithoutNull</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;ExpandEnvironmentStrings&quot;</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-79"></span><span>      </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">len</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">c_ExpandEnvironmentStrings</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">len</span><span class="hs-special">)</span><span> </span><span class="hs-number">512</span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h ExpandEnvironmentStringsW&quot;</span><span>
</span><span id="line-82"></span><span>  </span><span class="hs-identifier">c_ExpandEnvironmentStrings</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-83"></span><span>
</span><span id="line-84"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-85"></span><span class="hs-comment">-- Computer Name</span><span>
</span><span id="line-86"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span class="hs-identifier">getComputerName</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">String</span><span>
</span><span id="line-89"></span><span class="hs-identifier">getComputerName</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-90"></span><span>  </span><span class="hs-identifier">withTStringBuffer</span><span>  </span><span class="hs-identifier">maxLength</span><span>  </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">buf</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-91"></span><span>  </span><span class="hs-identifier">with</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">maxLength</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">len</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-92"></span><span>      </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;GetComputerName&quot;</span><span>
</span><span id="line-93"></span><span>        </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetComputerName</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">len</span><span>
</span><span id="line-94"></span><span>      </span><span class="hs-identifier">len'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">len</span><span>
</span><span id="line-95"></span><span>      </span><span class="hs-identifier">peekTStringLen</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">buf</span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">len'</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-96"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-97"></span><span>    </span><span class="hs-identifier">maxLength</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">15</span><span>
</span><span id="line-98"></span><span class="hs-pragma">{-# LINE 98 &quot;libraries\\Win32\\System\\Win32\\Info\\Computer.hsc&quot; #-}</span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;GetComputerNameW&quot;</span><span>
</span><span id="line-100"></span><span>  </span><span class="hs-identifier">c_GetComputerName</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPDWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span class="hs-identifier">setComputerName</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-103"></span><span class="hs-identifier">setComputerName</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-104"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">buf</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-105"></span><span>      </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;SetComputerName&quot;</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-106"></span><span>        </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_SetComputerName</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;SetComputerNameW&quot;</span><span>
</span><span id="line-109"></span><span>  </span><span class="hs-identifier">c_SetComputerName</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-110"></span><span class="hs-comment">{-
type COMPUTER_NAME_FORMAT = UINT
{enum COMPUTER_NAME_FORMAT,
 , computerNameNetBIOS                   = ComputerNameNetBIOS
 , computerNameDnsHostname               = ComputerNameDnsHostname
 , computerNameDnsDomain                 = ComputerNameDnsDomain
 , computerNameDnsFullyQualified         = ComputerNameDnsFullyQualified
 , computerNamePhysicalNetBIOS           = ComputerNamePhysicalNetBIOS
 , computerNamePhysicalDnsHostname       = ComputerNamePhysicalDnsHostname
 , computerNamePhysicalDnsDomain         = ComputerNamePhysicalDnsFullyQualified
 , computerNamePhysicalDnsFullyQualified = ComputerNamePhysicalDnsFullyQualified
 , computerNameMax                       = ComputerNameMax
 }
-}</span><span>
</span><span id="line-124"></span><span>
</span><span id="line-125"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-126"></span><span class="hs-comment">-- Hardware Profiles</span><span>
</span><span id="line-127"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-128"></span><span class="hs-comment">{-
-- TODO: Deside HW_PROFILE_INFO type design

type LPHW_PROFILE_INFO = Ptr HW_PROFILE_INFO

data HW_PROFILE_INFO = HW_PROFILE_INFO
     { dwDockInfo       :: DWORD
     , szHwProfileGuid  :: String -- Should we use GUID type instead of String?
     , szHwProfileName  :: String
     } deriving Show

instance Storable HW_PROFILE_INFO where
    sizeOf = const #{size HW_PROFILE_INFOW}
    alignment _ = #alignment HW_PROFILE_INFOW
    poke buf info = do
        (#poke HW_PROFILE_INFOW, dwDockInfo) buf (dwDockInfo info)
        withTString (szHwProfileGuid info) $ \szHwProfileGuid' -&gt;
          (#poke HW_PROFILE_INFOW, szHwProfileGuid) buf szHwProfileGuid'
        withTString (szHwProfileName info) $ \szHwProfileName' -&gt;
          (#poke HW_PROFILE_INFOW, szHwProfileName) buf szHwProfileName'

    peek buf = do
        dockInfo       &lt;- (#peek HW_PROFILE_INFOW, dwDockInfo) buf
        hwProfileGuid  &lt;- peekTString $ (#ptr HW_PROFILE_INFOW, szHwProfileGuid) buf
        hwProfileName  &lt;- peekTString $ (#ptr HW_PROFILE_INFOW, szHwProfileName) buf
        return $ HW_PROFILE_INFO dockInfo hwProfileGuid hwProfileName

getCurrentHwProfile :: IO HW_PROFILE_INFO
getCurrentHwProfile =
  alloca $ \buf -&gt; do
    failIfFalse_ &quot;GetCurrentHwProfile&quot;
      $ c_GetCurrentHwProfile buf
    peek buf

foreign import WINDOWS_CCONV unsafe &quot;windows.h GetCurrentHwProfileW&quot;
  c_GetCurrentHwProfile :: LPHW_PROFILE_INFO -&gt; IO Bool
-}</span><span>
</span><span id="line-165"></span><span>
</span><span id="line-166"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-167"></span><span class="hs-comment">-- System metrics</span><span>
</span><span id="line-168"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetSystemMetrics&quot;</span><span>
</span><span id="line-171"></span><span>  </span><span class="hs-identifier">getSystemMetrics</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Int</span><span>
</span><span id="line-172"></span><span>
</span><span id="line-173"></span><span class="hs-identifier">sM_CMONITORS</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span>
</span><span id="line-174"></span><span class="hs-identifier">sM_CMONITORS</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">80</span><span>
</span><span id="line-175"></span><span class="hs-identifier">sM_IMMENABLED</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span>
</span><span id="line-176"></span><span class="hs-identifier">sM_IMMENABLED</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">82</span><span>
</span><span id="line-177"></span><span class="hs-identifier">sM_MOUSEWHEELPRESENT</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span>
</span><span id="line-178"></span><span class="hs-identifier">sM_MOUSEWHEELPRESENT</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">75</span><span>
</span><span id="line-179"></span><span class="hs-identifier">sM_REMOTESESSION</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span>
</span><span id="line-180"></span><span class="hs-identifier">sM_REMOTESESSION</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4096</span><span>
</span><span id="line-181"></span><span class="hs-identifier">sM_SAMEDISPLAYFORMAT</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span>
</span><span id="line-182"></span><span class="hs-identifier">sM_SAMEDISPLAYFORMAT</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">81</span><span>
</span><span id="line-183"></span><span class="hs-identifier">sM_XVIRTUALSCREEN</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span>
</span><span id="line-184"></span><span class="hs-identifier">sM_XVIRTUALSCREEN</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">76</span><span>
</span><span id="line-185"></span><span class="hs-identifier">sM_YVIRTUALSCREEN</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span>
</span><span id="line-186"></span><span class="hs-identifier">sM_YVIRTUALSCREEN</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">77</span><span>
</span><span id="line-187"></span><span class="hs-identifier">sM_SERVERR2</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span>
</span><span id="line-188"></span><span class="hs-identifier">sM_SERVERR2</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">89</span><span>
</span><span id="line-189"></span><span class="hs-identifier">sM_MEDIACENTER</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span>
</span><span id="line-190"></span><span class="hs-identifier">sM_MEDIACENTER</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">87</span><span>
</span><span id="line-191"></span><span class="hs-identifier">sM_STARTER</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span>
</span><span id="line-192"></span><span class="hs-identifier">sM_STARTER</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">88</span><span>
</span><span id="line-193"></span><span class="hs-identifier">sM_TABLETPC</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">SMSetting</span><span>
</span><span id="line-194"></span><span class="hs-identifier">sM_TABLETPC</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">86</span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span class="hs-pragma">{-# LINE 186 &quot;libraries\\Win32\\System\\Win32\\Info\\Computer.hsc&quot; #-}</span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-188"></span><span class="hs-comment">-- User name</span><span>
</span><span id="line-189"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span class="hs-comment">-- | Get user name. See: &lt;https://github.com/haskell/win32/issues/8&gt;, &lt;http://lpaste.net/41521&gt;</span><span>
</span><span id="line-192"></span><span class="hs-identifier">getUserName</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">String</span><span>
</span><span id="line-193"></span><span class="hs-identifier">getUserName</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-194"></span><span>  </span><span class="hs-identifier">withTStringBuffer</span><span>  </span><span class="hs-identifier">maxLength</span><span>  </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">buf</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-195"></span><span>  </span><span class="hs-identifier">with</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">maxLength</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">len</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-196"></span><span>      </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;GetComputerName&quot;</span><span>
</span><span id="line-197"></span><span>        </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetUserName</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">len</span><span>
</span><span id="line-198"></span><span>      </span><span class="hs-comment">-- GetUserNameW includes NUL charactor.</span><span>
</span><span id="line-199"></span><span>      </span><span class="hs-identifier">peekTString</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-200"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-comment">-- This requires Lmcons.h</span><span>
</span><span id="line-202"></span><span>    </span><span class="hs-identifier">maxLength</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">256</span><span>
</span><span id="line-203"></span><span class="hs-pragma">{-# LINE 203 &quot;libraries\\Win32\\System\\Win32\\Info\\Computer.hsc&quot; #-}</span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetUserNameW&quot;</span><span>
</span><span id="line-205"></span><span>  </span><span class="hs-identifier">c_GetUserName</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPDWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-208"></span><span class="hs-comment">-- Processor features</span><span>
</span><span id="line-209"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h IsProcessorFeaturePresent&quot;</span><span>
</span><span id="line-212"></span><span>  </span><span class="hs-identifier">isProcessorFeaturePresent</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">BOOL</span><span>
</span><span id="line-213"></span><span>
</span><span id="line-214"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-215"></span><span>
</span><span id="line-216"></span><span class="hs-identifier">pF_3DNOW_INSTRUCTIONS_AVAILABLE</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span>
</span><span id="line-217"></span><span class="hs-identifier">pF_3DNOW_INSTRUCTIONS_AVAILABLE</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">7</span><span>
</span><span id="line-218"></span><span class="hs-identifier">pF_COMPARE_EXCHANGE_DOUBLE</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span>
</span><span id="line-219"></span><span class="hs-identifier">pF_COMPARE_EXCHANGE_DOUBLE</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-220"></span><span class="hs-identifier">pF_FLOATING_POINT_EMULATED</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span>
</span><span id="line-221"></span><span class="hs-identifier">pF_FLOATING_POINT_EMULATED</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-222"></span><span class="hs-identifier">pF_FLOATING_POINT_PRECISION_ERRATA</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span>
</span><span id="line-223"></span><span class="hs-identifier">pF_FLOATING_POINT_PRECISION_ERRATA</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-224"></span><span class="hs-identifier">pF_MMX_INSTRUCTIONS_AVAILABLE</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span>
</span><span id="line-225"></span><span class="hs-identifier">pF_MMX_INSTRUCTIONS_AVAILABLE</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">3</span><span>
</span><span id="line-226"></span><span class="hs-identifier">pF_PAE_ENABLED</span><span>                       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span>
</span><span id="line-227"></span><span class="hs-identifier">pF_PAE_ENABLED</span><span>                       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">9</span><span>
</span><span id="line-228"></span><span class="hs-identifier">pF_RDTSC_INSTRUCTION_AVAILABLE</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span>
</span><span id="line-229"></span><span class="hs-identifier">pF_RDTSC_INSTRUCTION_AVAILABLE</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-230"></span><span class="hs-identifier">pF_XMMI_INSTRUCTIONS_AVAILABLE</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span>
</span><span id="line-231"></span><span class="hs-identifier">pF_XMMI_INSTRUCTIONS_AVAILABLE</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">6</span><span>
</span><span id="line-232"></span><span class="hs-identifier">pF_XMMI64_INSTRUCTIONS_AVAILABLE</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ProcessorFeature</span><span>
</span><span id="line-233"></span><span class="hs-identifier">pF_XMMI64_INSTRUCTIONS_AVAILABLE</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">10</span><span>
</span><span id="line-234"></span><span>
</span><span id="line-235"></span><span class="hs-pragma">{-# LINE 227 &quot;libraries\\Win32\\System\\Win32\\Info\\Computer.hsc&quot; #-}</span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span class="hs-comment">{-
 , pF_CHANNELS_ENABLED                 = PF_CHANNELS_ENABLED
 , pF_NX_ENABLED                       = PF_NX_ENABLED
 , pF_COMPARE_EXCHANGE128              = PF_COMPARE_EXCHANGE128
 , pF_COMPARE64_EXCHANGE128            = PF_COMPARE64_EXCHANGE128
 , pF_SECOND_LEVEL_ADDRESS_TRANSLATION = PF_SECOND_LEVEL_ADDRESS_TRANSLATION
 , pF_SSE3_INSTRUCTIONS_AVAILABLE      = PF_SSE3_INSTRUCTIONS_AVAILABLE
 , pF_VIRT_FIRMWARE_ENABLED            = PF_VIRT_FIRMWARE_ENABLED
 , pF_XSAVE_ENABLED                    = PF_XSAVE_ENABLED
-}</span><span>
</span><span id="line-238"></span></pre></body></html>